# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=backdoor-apk
pkgver=141.2710126
pkgrel=1
pkgdesc='Shell script that simplifies the process of adding a backdoor to any Android APK file'
arch=('any')
groups=('blackarch' 'blackarch-mobile' 'blackarch-backdoor')
url='https://github.com/dana-at-cp/backdoor-apk'
license=('Apache')
depends=('smali')
makedepends=('git')
source=("git+https://github.com/dana-at-cp/$pkgname.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}


package() {
  cd $pkgname

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname" README.md
  install -Dm 644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"

  cp -a --no-preserve=ownership "$pkgname/"* "$pkgdir/usr/share/$pkgname/"

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
cd /usr/share/$pkgname
exec sh $pkgname.sh "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"
}

